﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage<ChoViet.CMS.ViewModels.ArticleCategoryIndexViewModel>" %>
<%@ Import Namespace="ChoViet.Lib.Helpers" %>
<asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server">
	Chuyên mục  bài viết
</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="Header" runat="server">
	Chuyên mục bài viết
</asp:Content>
<asp:Content ID="Content6" ContentPlaceHolderID="Message" runat="server">
    <%=ViewData["MessageInfo"]!=null? "<p class='perror'>"+Html.Encode(ViewData["MessageInfo"])+"</p>":string.Empty%> 
</asp:Content>
<asp:Content ID="Content4" ContentPlaceHolderID="Toolbar" runat="server">
	<%= Html.Toolbar("Thêm mới", "/ArticleCategory/CreateCms/", "new")%>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
<%if(ViewData["MessageInfo"]==null){ %>
	<form action="/ArticleCategory/IndexCms" method="post" name="adminForm">
		<table width="100%" class="adminlist">
			<tr>
				<th width="10" align="right">STT</th>
				<th width="30"></th>
				<th width="30"></th>
				<th>
					<%= Html.Sort("Tên chuyên mục", "Name", ViewData["orderDir"].ToString(), ViewData["order"].ToString())%>
				</th>
				<th>
					<%= Html.Sort("Độ ưu tiên", "Priority", ViewData["orderDir"].ToString(), ViewData["order"].ToString())%>
				</th>
				<th width="60">
					Kích hoạt
				</th>				
				<th width="30">
					<%= Html.Sort("ID", "ID", ViewData["orderDir"].ToString(), ViewData["order"].ToString())%>
				</th>
			</tr>
		<% 
			int i = 1;
    		foreach (var item in Model.ArticleCategories) {
		%>		
			<tr>
				<td align="center">
					<%= i.ToString() %>
				</td>
				<td align="center">
					<%= Html.ActionImage("Sửa", "icon-24-edit.png", "ArticleCategory", "EditCms", new Dictionary<string, object>() { { "id", Convert.ToInt32(item.ID) } })%>
				</td>
				 <td align="center">
					<%= Html.ActionImage("Xóa", "icon-24-delete.png", "ArticleCategory", "DeleteCms", new Dictionary<string, object>() { { "id", Convert.ToInt32(item.ID) } })%>
				</td>
				<td>
					<%= Html.Encode(item.Name)%>
				</td>
				<td>
				    <%=Html.Encode(item.Priority.ToString())%>
				</td>
				<td align="center">
                    <img alt="" id="ActiveYN_<%= item.ID %>" onclick="ChangeActiveYN(<%= item.ID %>);" value="<%= item.ActiveYN %>"
                        src="<%= item.ActiveYN? "/Images/icon-32-apply.png" : "/Images/icon-32-cancel.png" %>" />
                </td>
				<td align="center">
					<%= Html.Encode(item.ID) %>
				</td>
			</tr>
	    
		<% i++;
            } %>

		</table>
		<%= Html.Hidden("order")%>
		<%= Html.Hidden("orderDir")%>
	</form>
<% } %>
<script type="text/javascript">
    function ChangeActiveYN(id) {
        var obj = $("#ActiveYN_" + id);
        ApplyChangeYN("/Applications/UpdateArticleCategoryActiveYN/" + id + '/' + obj.attr("value"), id, obj);
    }
    </script>
</asp:Content>
